// 通用响应函数
function sendResponse(res, code, message, data = null) {
  res.status(code).json({
    code: code,
    msg: message,
    data: data
  });
}

// 列表响应函数
function sendListResponse(res, code, message, list, total) {
  const response = {
    code: code,
    msg: message,
    list,
    total,
  };
  res.status(code).json(response);
}

module.exports = {
  sendResponse,
  sendListResponse
};